#include "StdAfx.h"
#include <pgl/lua/LibLoader.h>

extern "C"
{
#include <lua/include/lua.h>
#include <lua/include/lualib.h>
#include <lua/include/lauxlib.h>
};
#include <luabind/luabind.hpp>
#include <luabind/object.hpp>

#include <pgl/mfc/PGLCAPI.h>

namespace pgl
{

lua_State* load_pgl(lua_State* L)
{
	using namespace luabind;

	module(L,"pgl")
	[
		 def("init",&pglInit)
		,def("quit",&pglQuit)
		,def("figure",&pglFigure)
		,def("region",&pglRegion)
		,def("get_cr",&pglGetCR)
		,def("set_cr",&pglSetCR)
		,def("get_cd",&pglGetCD)
		,def("do_modal_region",&pglDoModalRegion)
		,def("close_figure",&pglCloseFigure)
		,def("close_all_figures",&pglCloseAllFigures)
		,def("close_region",&pglCloseRegion)
		,def("close_all_regions",&pglCloseAllRegions)
		,def("get_object_size",&pglGetObjectsSize)
		,def("get_object",&pglGetObject)
		,def("remove_object",&pglRemoveObject)
		,def("get_children_size",&pglGetChildrenSize)
		,def("get_child",&pglGetChild)
		,def("remove_child",&pglRemoveChild)

		,def("divide",&pglDivide)
		,def("layout",&pglLayout)
		,def("get_parent",&pglGetParent)
		,def("out_of_child",&pglOutOfChild)

		,def("plot",&pglPlot)
//		,def("plot_y",&pglPlotY)
//		,def("plot_lod",&pglPlotLOD)
//		,def("plot_lod_y",&pglPlotLODY)
		,def("plot_fcn",&pglPlotFcn)
//		,def("plot_fcn_y",&pglPlotFcnY)
		,def("plot_hor",&pglPlotHor)
		,def("plot_ver",&pglPlotVer)
		,def("histogram",&pglHistogram)
//		,def("error_bar",&pglErrorBar)
//		,def("error_bar_y",&pglErrorBar)
//		,def("scatter",&pglScatter)
//		,def("stock",&pglStock)
//		,def("candlestick",&pglCandleStick)
		,def("image",&pglImage)

		,def("set",&pglSet)
//		,def("get",&pglGet)
//		,def("get_help",&pglGetHelp)

		,def("left_label",&pglLeftLabel)
		,def("bottom_label",&pglBottomLabel)
		,def("right_label",&pglRightLabel)
		,def("top_label",&pglTitle)
		,def("title",&pglTitle)
		,def("legend",&pglLegend)

		,def("zoom_all",&pglZoomAll)
		,def("zoom",&pglZoom)
//		,def("get_zoom",&pglGetZoom)

		,def("auto_zoom",&pglAutoZoom)
		,def("load_from_xml",&pglLoadFromXML)
		,def("save_to_xml",&pglSaveToXML)
		,def("render_to_file",&pglRenderToFile)
//		,def("render_to_bitmap",&pglRenderToBitmap)
		,def("load_csv_file",&pglLoadCSVFile)
	];

	return L;
}

}